﻿#include "Camera.h"


namespace Base {
	void Camera::SetPerspective(float fovy, float aspect, float pNear, float pFar) {
		mFovy = fovy;
		mAspect = aspect;
		mNear = pNear;
		mFar = pFar;
		mProjMatrix = Matrix4x4::CreatePerspectiveFovLH(mFovy, mAspect, mNear, mFar);
	}
	void Camera::UpdateAspect(float aspect) {
		mAspect = aspect;
		mProjMatrix = Matrix4x4::CreatePerspectiveFovLH(mFovy, mAspect, mNear, mFar);
	}
	void Camera::SetLookAt(const Vec3& pos, const Vec3& target, const Vec3& up) {
		XMStoreFloat4x4(&mViewMatrix.data, XMMatrixLookAtLH(
			XMLoadFloat3(&pos.data),
			XMLoadFloat3(&target.data),
			XMLoadFloat3(&up.data)
		));
	}
}